package com.umeng.analytics.pro;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class dr extends dt {
    protected InputStream a;
    protected OutputStream b;

    public dr(InputStream arg2) {

        this.a = null;
        this.b = null;
        this.a = arg2;
    }

    public dr(OutputStream arg2) {

        this.a = null;
        this.b = null;
        this.b = arg2;
    }

    protected dr() {

        this.a = null;
        this.b = null;
    }

    public dr(InputStream arg2, OutputStream arg3) {

        this.a = null;
        this.b = null;
        this.a = arg2;
        this.b = arg3;
    }

    public int a(byte[] arg4, int arg5, int arg6) throws du {
        int v0_1;
        if (this.a == null) {
            throw new du(1, "Cannot read from null inputStream");
        }

        try {
            v0_1 = this.a.read(arg4, arg5, arg6);
            if (v0_1 >= 0) {
                return v0_1;
            }
        } catch (IOException v0) {
            throw new du(0, ((Throwable) v0));
        }
        throw new du(4);
    }

    public boolean a() {
        return true;
    }

    public void b() throws du {
    }

    public void b(byte[] arg4, int arg5, int arg6) throws du {
        if (this.b == null) {
            throw new du(1, "Cannot write to null outputStream");
        }

        try {
            this.b.write(arg4, arg5, arg6);
            return;
        } catch (IOException v0) {
            throw new du(0, ((Throwable) v0));
        }
    }

    public void c() {
        InputStream v1 = null;
        if (this.a != null) {
            try {
                this.a.close();
            } catch (IOException v0) {
                v0.printStackTrace();
            }

            this.a = v1;
        }

        if (this.b != null) {
            try {
                this.b.close();
            } catch (IOException v0) {
                v0.printStackTrace();
            }

            this.b = ((OutputStream) null);
        }
    }

    public void d() throws du {
        if (this.b == null) {
            throw new du(1, "Cannot flush null outputStream");
        }

        try {
            this.b.flush();
            return;
        } catch (IOException v0) {
            throw new du(0, ((Throwable) v0));
        }
    }
}

